{*
 * This file is part of the Agora distribution. 
 * Detailed copyright and licensing information can be found
 * in the gpl-3.0.txt file which should be included in the distribution.
 * 
 * @version		$Id: 3.0.14 Olympus 2010-09-28 rammstein4o $
 * @copyright  2007 - 2010 jVitals
 * @license   GPLv3 Open Source
 * @link       http://jvitals.com
 * @since      File available since initial release
 *}
{if $agora_config.o_rss_enabled}
{feed task=rss key=$agora_user.rss_id}
{/if}
<script type="text/javascript">
<!--
{literal}
function addSliders(cat_id)
{
	var status = {
		'false': 'open',
		'true': 'close'
	};
	//-vertical
	var slide = new Fx.Slide('pp_'+cat_id, {duration: 300});
	if(getCookie('pp_'+cat_id)=='close')
	slide.toggle();
	$('toggle'+cat_id).addEvent('click', function(e){
		e = new Event(e);
		if (slide.open) {
			slide.slideOut();
			$('img_up_'+cat_id).setStyle('display','none');
			$('img_down_'+cat_id).setStyle('display','inline');
		} else {
			slide.slideIn();
			$('img_up_'+cat_id).setStyle('display','inline');
			$('img_down_'+cat_id).setStyle('display','none');
		}
		e.stop();
		setCookie('pp_'+cat_id,status[slide.open]);
	});

	if(getCookie('pp_'+cat_id)=='close') {
		slide.slideIn();
		$('img_up_'+cat_id).setStyle('display','none');
		$('img_down_'+cat_id).setStyle('display','inline');
	} else {
		$('img_up_'+cat_id).setStyle('display','inline');
		$('img_down_'+cat_id).setStyle('display','none');
	}
}
{/literal}

window.addEvent('domready', function() {ldelim}
{foreach from=$categories item=cat}
	addSliders({$cat.id});
{/foreach}
{rdelim});
//-->
</script>

{if isset($ag_groups) or $post_poll or $post_topic or $forum.closed}
<div class="ag_forumButtons_wrap">
	<div class="ag_inbox">
		<div class="ag_forumButtons">
			{include file=agora:misc/topic_buttons.tpl}
		</div>
	</div>
</div>
{/if}

{foreach name=category_loop from=$categories key=cat_count item=cat}
<div class="ag_rightend">
	<h2 class="ag_headerbar">
		<span class="ag_middle">
			<a class="ag_good_link" href="{url id=$cat.id}">{$cat.cat_name}</a>

			<span class="ag_forum_collapse">
				<a id="toggle{$cat.id}" href="javascript:void(0);" name="toggle{$cat.id}">
					<img src="{image src=exp_up.png}" alt="##Collapse##" title="##Collapse##" id="img_up_{$cat.id}" />
					<img style="display: none" src="{image src=exp_down.png}" alt="##Expand##" title="##Expand##" id="img_down_{$cat.id}" />
				</a>
			</span>
		</span>
	</h2>
</div>

<div id="idx{$cat_count}" class="ag_tablewrap">
	<div id="pp_{$cat.id}">
		<div class="ag_forumcat" id="box_{$cat_count}">
			<table width="100%" border="0" cellpadding="0" cellspacing="0">
				<thead>
					<tr>
						<th class="ag_leftend">
							{if $agora_config.o_rss_enabled}
							<span>
								<a href="{url task=rss format=feed type=rss cid=$cat.id key=$agora_user.rss_id}" title="##RSS FEED##">
									<img src="{image src=icons/rss.png}" alt="##RSS FEED##" />
								</a>
							</span>
							{else}
							<span>&nbsp;</span>
							{/if}
						</th>
						<th class="ag_column">##Forums##</th>
						<th class="ag_topic">##Stats##</th>
						<th class="ag_lastpost">##Last post##</th>
					</tr>
				</thead>
				<tbody>
				{foreach name=forum from=$cat.forums key=forum_num item=forum}
					<tr class="{if !empty($forum.ref_name)}{$forum.ref_name}{else}{$cat.ref_name}{/if}">
						{include file=agora:include/forum_row.tpl forum=$forum}
					</tr>
				{/foreach}
				</tbody>
			</table>
		</div>
	</div>
</div>

{moduleExists name=agora_main}
{if $smarty.foreach.category_loop.iteration == 1}
<div class="ag_adsense">
	{loadModule name=agora_main}
</div>
<div class="ag_clearer"></div>
{/if}
{/moduleExists}

<div class="ag_forum_separator"></div>
{/foreach}